﻿#Region "Microsoft.VisualBasic::a55814194d2a23aab8fecfe3cd84b366, Google.Protobuf\WellKnownTypes\Any.vb"

    ' Author:
    ' 
    '       asuka (amethyst.asuka@gcmodeller.org)
    '       xie (genetics@smrucc.org)
    '       xieguigang (xie.guigang@live.com)
    ' 
    ' Copyright (c) 2018 GPL3 Licensed
    ' 
    ' 
    ' GNU GENERAL PUBLIC LICENSE (GPL3)
    ' 
    ' 
    ' This program is free software: you can redistribute it and/or modify
    ' it under the terms of the GNU General Public License as published by
    ' the Free Software Foundation, either version 3 of the License, or
    ' (at your option) any later version.
    ' 
    ' This program is distributed in the hope that it will be useful,
    ' but WITHOUT ANY WARRANTY; without even the implied warranty of
    ' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ' GNU General Public License for more details.
    ' 
    ' You should have received a copy of the GNU General Public License
    ' along with this program. If not, see <http://www.gnu.org/licenses/>.



    ' /********************************************************************************/

    ' Summaries:

    '     Module AnyReflection
    ' 
    '         Properties: Descriptor
    ' 
    '         Constructor: (+1 Overloads) Sub New
    ' 
    '     Class Any
    ' 
    '         Properties: Descriptor, DescriptorProp, Parser, TypeUrl, Value
    ' 
    '         Constructor: (+2 Overloads) Sub New
    ' 
    '         Function: CalculateSize, Clone, (+2 Overloads) Equals, GetHashCode, ToString
    ' 
    '         Sub: (+2 Overloads) MergeFrom, OnConstruction, WriteTo
    ' 
    ' 
    ' /********************************************************************************/

#End Region

' Generated by the protocol buffer compiler.  DO NOT EDIT!
' source: google/protobuf/any.proto
#Region "Designer generated code"

Imports Microsoft.VisualBasic.Language
Imports pbr = Google.Protobuf.Reflection

Namespace Google.Protobuf.WellKnownTypes

    ''' <summary>Holder for reflection information generated from google/protobuf/any.proto</summary>
    Public Partial Module AnyReflection

#Region "Descriptor"
        ''' <summary>File descriptor for google/protobuf/any.proto</summary>
        Public ReadOnly Property Descriptor As pbr.FileDescriptor
            Get
                Return descriptorField
            End Get
        End Property

        Private descriptorField As pbr.FileDescriptor

        Sub New()
            Dim descriptorData As Byte() = Global.System.Convert.FromBase64String(String.Concat("Chlnb29nbGUvcHJvdG9idWYvYW55LnByb3RvEg9nb29nbGUucHJvdG9idWYi", "JgoDQW55EhAKCHR5cGVfdXJsGAEgASgJEg0KBXZhbHVlGAIgASgMQnIKE2Nv", "bS5nb29nbGUucHJvdG9idWZCCEFueVByb3RvUAFaJWdpdGh1Yi5jb20vZ29s", "YW5nL3Byb3RvYnVmL3B0eXBlcy9hbnmgAQGiAgNHUEKqAh5Hb29nbGUuUHJv", "dG9idWYuV2VsbEtub3duVHlwZXNiBnByb3RvMw=="))
            descriptorField = pbr.FileDescriptor.FromGeneratedCode(descriptorData, New pbr.FileDescriptor() {}, New pbr.GeneratedClrTypeInfo(Nothing, New pbr.GeneratedClrTypeInfo() {New pbr.GeneratedClrTypeInfo(GetType(Global.Google.Protobuf.WellKnownTypes.Any), Global.Google.Protobuf.WellKnownTypes.Any.Parser, {"TypeUrl", "Value"}, Nothing, Nothing, Nothing)}))
        End Sub
#End Region

    End Module
#Region "Messages"
    ''' <summary>
    '''  `Any` contains an arbitrary serialized protocol buffer message along with a
    '''  URL that describes the type of the serialized message.
    '''
    '''  Protobuf library provides support to pack/unpack Any values in the form
    '''  of utility functions or additional generated methods of the Any type.
    '''
    '''  Example 1: Pack and unpack a message in C++.
    '''
    '''      Foo foo = ...;
    '''      Any any;
    '''      any.PackFrom(foo);
    '''      ...
    '''      if (any.UnpackTo(&amp;foo)) {
    '''        ...
    '''      }
    '''
    '''  Example 2: Pack and unpack a message in Java.
    '''
    '''      Foo foo = ...;
    '''      Any any = Any.pack(foo);
    '''      ...
    '''      if (any.is(Foo.class)) {
    '''        foo = any.unpack(Foo.class);
    '''      }
    '''
    '''   Example 3: Pack and unpack a message in Python.
    '''
    '''      foo = Foo(...)
    '''      any = Any()
    '''      any.Pack(foo)
    '''      ...
    '''      if any.Is(Foo.DESCRIPTOR):
    '''        any.Unpack(foo)
    '''        ...
    '''
    '''  The pack methods provided by protobuf library will by default use
    '''  'type.googleapis.com/full.type.name' as the type URL and the unpack
    '''  methods only use the fully qualified type name after the last '/'
    '''  in the type URL, for example "foo.bar.com/x/y.z" will yield type
    '''  name "y.z".
    '''
    '''  JSON
    '''  ====
    '''  The JSON representation of an `Any` value uses the regular
    '''  representation of the deserialized, embedded message, with an
    '''  additional field `@type` which contains the type URL. Example:
    '''
    '''      package google.profile;
    '''      message Person {
    '''        string first_name = 1;
    '''        string last_name = 2;
    '''      }
    '''
    '''      {
    '''        "@type": "type.googleapis.com/google.profile.Person",
    '''        "firstName": &lt;string>,
    '''        "lastName": &lt;string>
    '''      }
    '''
    '''  If the embedded message type is well-known and has a custom JSON
    '''  representation, that representation will be embedded adding a field
    '''  `value` which holds the custom JSON in addition to the `@type`
    '''  field. Example (for message [google.protobuf.Duration][]):
    '''
    '''      {
    '''        "@type": "type.googleapis.com/google.protobuf.Duration",
    '''        "value": "1.212s"
    '''      }
    ''' </summary>
    Public NotInheritable Partial Class Any
        Implements IMessageType(Of Any)

        Private Shared ReadOnly _parser As MessageParserType(Of Any) = New MessageParserType(Of Any)(Function() New Any())

        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute>
        Public Shared ReadOnly Property Parser As MessageParserType(Of Any)
            Get
                Return _parser
            End Get
        End Property

        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute>
        Public Shared ReadOnly Property DescriptorProp As pbr.MessageDescriptor
            Get
                Return Global.Google.Protobuf.WellKnownTypes.AnyReflection.Descriptor.MessageTypes(0)
            End Get
        End Property

        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute>
        Private ReadOnly Property Descriptor As pbr.MessageDescriptor Implements IMessage.Descriptor
            Get
                Return DescriptorProp
            End Get
        End Property

        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute>
        Public Sub New()
            OnConstruction()
        End Sub

        Partial Private Sub OnConstruction()
        End Sub

        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute>
        Public Sub New(other As Any)
            Me.New()
            typeUrl_ = other.typeUrl_
            value_ = other.value_
        End Sub

        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute>
        Public Function Clone() As Any Implements IDeepCloneable(Of Any).Clone
            Return New Any(Me)
        End Function

        ''' <summary>Field number for the "type_url" field.</summary>
        Public Const TypeUrlFieldNumber As Integer = 1
        Private typeUrl_ As String = ""
        ''' <summary>
        '''  A URL/resource name whose content describes the type of the
        '''  serialized protocol buffer message.
        '''
        '''  For URLs which use the scheme `http`, `https`, or no scheme, the
        '''  following restrictions and interpretations apply:
        '''
        '''  * If no scheme is provided, `https` is assumed.
        '''  * The last segment of the URL's path must represent the fully
        '''    qualified name of the type (as in `path/google.protobuf.Duration`).
        '''    The name should be in a canonical form (e.g., leading "." is
        '''    not accepted).
        '''  * An HTTP GET on the URL must yield a [google.protobuf.Type][]
        '''    value in binary format, or produce an error.
        '''  * Applications are allowed to cache lookup results based on the
        '''    URL, or have them precompiled into a binary to avoid any
        '''    lookup. Therefore, binary compatibility needs to be preserved
        '''    on changes to types. (Use versioned type names to manage
        '''    breaking changes.)
        '''
        '''  Schemes other than `http`, `https` (or the empty scheme) might be
        '''  used with implementation specific semantics.
        ''' </summary>
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute>
        Public Property TypeUrl As String
            Get
                Return typeUrl_
            End Get
            Set(value As String)
                typeUrl_ = CheckNotNull(value, "value")
            End Set
        End Property

        ''' <summary>Field number for the "value" field.</summary>
        Public Const ValueFieldNumber As Integer = 2
        Private value_ As ByteString = ByteString.Empty
        ''' <summary>
        '''  Must be a valid serialized protocol buffer of the above specified type.
        ''' </summary>
        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute>
        Public Property Value As ByteString
            Get
                Return value_
            End Get
            Set(value As ByteString)
                value_ = CheckNotNull(value, "value")
            End Set
        End Property

        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute>
        Public Overrides Function Equals(other As Object) As Boolean
            Return Equals(TryCast(other, Any))
        End Function

        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute>
        Public Overloads Function Equals(other As Any) As Boolean Implements IEquatable(Of Any).Equals
            If ReferenceEquals(other, Nothing) Then
                Return False
            End If

            If ReferenceEquals(other, Me) Then
                Return True
            End If

            If Not Equals(TypeUrl, other.TypeUrl) Then Return False
            If Value IsNot other.Value Then Return False
            Return True
        End Function

        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute>
        Public Overrides Function GetHashCode() As Integer
            Dim hash = 1
            If TypeUrl.Length <> 0 Then hash = hash Xor TypeUrl.GetHashCode()
            If Value.Length <> 0 Then hash = hash Xor Value.GetHashCode()
            Return hash
        End Function

        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute>
        Public Overrides Function ToString() As String
            Return JsonFormatter.ToDiagnosticString(Me)
        End Function

        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute>
        Public Sub WriteTo(output As CodedOutputStream) Implements IMessage.WriteTo
            If TypeUrl.Length <> 0 Then
                output.WriteRawTag(10)
                output.WriteString(TypeUrl)
            End If

            If Value.Length <> 0 Then
                output.WriteRawTag(18)
                output.WriteBytes(Value)
            End If
        End Sub

        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute>
        Public Function CalculateSize() As Integer Implements IMessage.CalculateSize
            Dim size = 0

            If TypeUrl.Length <> 0 Then
                size += 1 + CodedOutputStream.ComputeStringSize(TypeUrl)
            End If

            If Value.Length <> 0 Then
                size += 1 + CodedOutputStream.ComputeBytesSize(Value)
            End If

            Return size
        End Function

        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute>
        Public Sub MergeFrom(other As Any) Implements IMessageType(Of Any).MergeFrom
            If other Is Nothing Then
                Return
            End If

            If other.TypeUrl.Length <> 0 Then
                TypeUrl = other.TypeUrl
            End If

            If other.Value.Length <> 0 Then
                Value = other.Value
            End If
        End Sub

        <Global.System.Diagnostics.DebuggerNonUserCodeAttribute>
        Public Sub MergeFrom(input As CodedInputStream) Implements IMessage.MergeFrom
            Dim tag As New Value(Of UInteger)

            While ((tag = input.ReadTag())) <> 0

                Select Case tag.Value
                    Case 10
                        TypeUrl = input.ReadString()

                    Case 18
                        Value = input.ReadBytes()

                    Case Else
                        input.SkipLastField()
                End Select
            End While
        End Sub
    End Class

#End Region

End Namespace
#End Region
